Linked List
-
Well Im a student and yesterday appeared in external examination (Lab Test)for "Data Structure Using C". I was asked to write a program to do following thing :
1.Read Unsorted data(Rno & Marks)from an existing data file.
2.Display Unsorted data.
3.Using Linked list, sort the data on the basis of Rno.
4.Display Sorted data in increasing order.
5.Display same sorted data in decreasing order.
6.Search a particular record on the basis of some key(Rno).In response what i did was
1.Make a write() and read() function in C using fopen() and fread() and fwrite().
2.Create a singly Linked list and while reading data in read() it used to fill it in the same way as it was stored on file.
3.Display the unsorted list.
4.Use bubble sort to sort the list and display it in Increasing order.
5.Searching on the basis of Rno.Sorry for posting such a huge amount of text but i wanna make things clear. My teacher told me that I should have put data into linked list in ordered manner while reading from file i.e. somewhat Insertion sort. I agreed but argued on the fact that question paper didnt mention to force me to use the best technique so i was free to use any sort. But the nutshell was that i was failed and was told to appear again for the test next year. Can any tell whether im right or wrong so that i can go to my HOD for the same.
Spread wat u Know!
-
Well Im a student and yesterday appeared in external examination (Lab Test)for "Data Structure Using C". I was asked to write a program to do following thing :
1.Read Unsorted data(Rno & Marks)from an existing data file.
2.Display Unsorted data.
3.Using Linked list, sort the data on the basis of Rno.
4.Display Sorted data in increasing order.
5.Display same sorted data in decreasing order.
6.Search a particular record on the basis of some key(Rno).In response what i did was
1.Make a write() and read() function in C using fopen() and fread() and fwrite().
2.Create a singly Linked list and while reading data in read() it used to fill it in the same way as it was stored on file.
3.Display the unsorted list.
4.Use bubble sort to sort the list and display it in Increasing order.
5.Searching on the basis of Rno.Sorry for posting such a huge amount of text but i wanna make things clear. My teacher told me that I should have put data into linked list in ordered manner while reading from file i.e. somewhat Insertion sort. I agreed but argued on the fact that question paper didnt mention to force me to use the best technique so i was free to use any sort. But the nutshell was that i was failed and was told to appear again for the test next year. Can any tell whether im right or wrong so that i can go to my HOD for the same.
Spread wat u Know!
Serious answer: Sounds to me like you got shafted :| Humorous answer: One of your superiors changed their mind about the spec, and then blamed you? Welcome to the world of software. ;)
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
-
Well Im a student and yesterday appeared in external examination (Lab Test)for "Data Structure Using C". I was asked to write a program to do following thing :
1.Read Unsorted data(Rno & Marks)from an existing data file.
2.Display Unsorted data.
3.Using Linked list, sort the data on the basis of Rno.
4.Display Sorted data in increasing order.
5.Display same sorted data in decreasing order.
6.Search a particular record on the basis of some key(Rno).In response what i did was
1.Make a write() and read() function in C using fopen() and fread() and fwrite().
2.Create a singly Linked list and while reading data in read() it used to fill it in the same way as it was stored on file.
3.Display the unsorted list.
4.Use bubble sort to sort the list and display it in Increasing order.
5.Searching on the basis of Rno.Sorry for posting such a huge amount of text but i wanna make things clear. My teacher told me that I should have put data into linked list in ordered manner while reading from file i.e. somewhat Insertion sort. I agreed but argued on the fact that question paper didnt mention to force me to use the best technique so i was free to use any sort. But the nutshell was that i was failed and was told to appear again for the test next year. Can any tell whether im right or wrong so that i can go to my HOD for the same.
Spread wat u Know!
Maybe I am missing something here, but requirements had 6 steps and you only listed 5. Did you remember to display it in descending order as well? I would hardly argue they could fail you if yousupplied all required steps, since there are no specifications regarding performance, system limitations, or otherwise. If I had said this would be a high load system and this would be done several times per hour, I might have had issue with the bubble sort and singly linked list. I think you would have found you had trouble with the descending display, unless you 'unbubbled' your items to reverse their order - basically you went through your list sorting it twice, then.