Skip to content

Kirubel-Eshetu/sorting-and-searching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

1๏ธโƒฃ Sorting and Searching ๐Ÿ”Ž

โœ… Implementation of simple sorting and searching algorithms using Cโž•โž•

1๏ธโƒฃ Sorting algorithms arrange a collection of items (like numbers or words) in a specific order, usually in ascending or descending order. The algortihms used for sorting the programs are Bubble sort, Insertion sort, Selection sort and Linked List.

๐Ÿ”Ž Searching algorithms find the position of a specific value within a collection of items. The algorithms used for searching are Linear search and Binary search.

๐Ÿ“š Book_Info.cpp -> Sorting and Searching of Book Information

๐Ÿ‘จ๐Ÿพโ€๐Ÿ’ป The program contains an implementation of simple sorting and searching algorithms, concepts in data structure and algorithm (DSA). For sorting purposes the program used bubble sort, selection sort and insertion sort and for searching linear and binary search were used. Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process is repeated until no swaps are needed, indicating that the list is sorted. Selection sort is a simple sorting algorithm that divides the input list into two parts: a sorted part at the beginning and an unsorted part at the end. Insertion sort is a simple sorting algorithm that works similar to how you might sort a hand of playing cards. It builds a sorted array one item at a time. Linear search, also known as sequential search, is a straightforward searching algorithm that examines each element in a list or array sequentially to find a target element. Binary search is a highly efficient searching algorithm that leverages the fact that the input list or array must be sorted. It works by repeatedly dividing the search interval in half.

๐ŸŒฑ Here is the general overview of the program:-
1๏ธโƒฃ When user presses "1", the program asks to set book information. Which is inserting Author name, Book title and Book Id. The program accepts only a number as Book ISBN. After the user inserts book information. They can perform the following operations:-
2๏ธโƒฃ View the book information inserted by pressing "2",
3๏ธโƒฃ Perform:- sort by Book Id by pressing "3" (using bubble sort)
4๏ธโƒฃ Sort by Book title by pressing "4" (using selection sort), sort by Author name by pressing "5" (using insertion sort)
5๏ธโƒฃ Search by book Id by pressing "6" (linear searching) and search by author name (using binary searching).
6๏ธโƒฃ Users can also press "8" know the team of the project and "0" to exit the program.

๐Ÿ’ข The main purpose of using these searching algorithms is to have organized data input and that of searching is accessing data in need without having to go through the entire data.
โณ The time it takes to sort a given amount of data varies from one sorting algorithm to another. Also the time it takes to access a data by searching varies from one searching algorithm to another. The time it take to sort or search data is called Time Complexity. All the concepts on this program are well taught on the course Data Structure and Algorithms (DSA).

๐Ÿ–ผ๏ธ You can find the output of the program on the image below ๐Ÿ’๐Ÿพโ€โ™‚๏ธ

HTML Image

๐ŸŽฌ Movie_Info.cpp -> Sorting of Movie Information using Linked List

๐ŸŸ  A linked list is a linear data structure that consists of a sequence of nodes, each containing two fields:
๐Ÿ“ Data: The actual data stored in the node and
โญ๏ธ Next: A pointer (link) to the next node in the sequence.
๐Ÿšฎ This structure allows for efficient insertion and deletion โŒ of elements at any position in the list, but accessing a specific element requires traversing the list from the beginning. ๐Ÿšฎ In the program, a user inputs information about movies and can use linked list to sort the information inserted.

๐ŸŒฑ Here is the general overview of the program:-

1๏ธโƒฃ By pressing "1", "2" and "3", user can add movie information at the start, at the end or at a specific place respectively.
2๏ธโƒฃ User also can delete movie information from the start, from the end or at a specific position by pressing "4", "5" and "6" respectively.
3๏ธโƒฃ Users can also press "7" to know team members of the project and "0" to exit the program.
๐Ÿ’ก Linked list is also a fundamental concept in the course Data Structre and Algorithms (DSA).

๐Ÿ–ผ๏ธ You can find the output of the program on the image below ๐Ÿ’๐Ÿพโ€โ™‚๏ธ

HTML Image

๐ŸŽ“ Student_Info.cpp -> Sorting and Searching of Student information

๐ŸŸ  The program contains an implementation of simple sorting and searching algorithms, concepts in data structure and algorithm (DSA). For sorting Bubble sort, Insertion sort and Selection sort were implmented and for searching Linear and Binary search were used.

๐ŸŒฑ Here is the general overview of the program:-

1๏ธโƒฃ When user presses "1", the program asks to enter student information after asking the amount of data recieved. Which is inserting Student Id, Student Name and Age. The program accepts only a number as Student Id. After the user inserts Student information. They can perform the following operations:-
2๏ธโƒฃ View the data inserted by pressing "2"
3๏ธโƒฃ Perform:- sort by Student Id by pressing "3" (using bubble sort)
4๏ธโƒฃ Sort by Student Name by pressing "4" (using selection sort)
5๏ธโƒฃ Sort by Age by pressing "5" (using insertion sort), search by Age by pressing "6" (linear searching) and search by Student name (using binary searching)
6๏ธโƒฃ User can also delete the data of Student after inserting Student Id by pressing "8"
7๏ธโƒฃ Users can press "9" to know team members of the project and "0" to exit the program.
๐Ÿ’ข The main purpose of using these searching algorithms is to have organized data input and that of searching is accessing data in need without having to go through the entire data.
โณ The time it takes to sort a given amount of data varies from one sorting algorithm to another. Also the time it takes to access a data by searching varies from one searching algorithm to another. The time it take to sort or search data is called Time Complexity. All the concepts on this program are well taught on the course Data Structure and Algorithms (DSA).

N.B: This project elaborates on the use of Simple sorting and searching algorithms after sorting and searching of book information program ๐Ÿ‘จ๐Ÿพโ€๐Ÿ’ป

๐Ÿ–ผ๏ธ You can find the output of the program on the image below ๐Ÿ’๐Ÿพโ€โ™‚๏ธ

HTML Image