Question:
create a linked list The data containing employee name and employee number is saved in a singly linked list?
Tulip
2013-03-31 02:48:10 UTC
Consider a scenario where a firm wants to maintain the data of its employees. The data containing employee name and employee number is saved in a singly linked list. Create functions for:
 
InsertAtFront: Insertion of a record at the front.
InsertAtEnd: Insertion of a record at the end.
Insert: Insertion of a record at any position in the list
DeleteFirst: Deletion of first record.
DeleteLast: Deletion of last record.
Delete: Deletion of a record at any position in the list.
Search: Searching any record based on employee number.
Display: Displaying all records.
Four answers:
?
2013-03-31 03:21:40 UTC
given the nature of the request to insert at front or end, rather than just insert in some meaningful sorted logic (in which case any insertion will do and the order makes little sense - ie front or end),

i say it is safe to conclude this is some homework task you were given?

which also means you are most likely required to implement a bare bones linked list code rather than use an already existing class in the language for it.



in this case, and since it is probably homework, try at least posting some of the code you wrote, show that you actually tried to do something rather than ask people "do my homework", and then a better question will be:

"why is this and that part of my code wont work in doing X"

i am sure more people will be happy to point out errors in the code as opposed to people willing to do your homework, just my 2 cents
anonymous
2013-03-31 02:57:20 UTC
Obviously this is very dependent on your choice of language and experience, however I would recommend either using an Array which you then save to a file or an SQL database. My preference would be the SQL though this is by no means the only option.



Also, why would you need to add and delete to and from the start or the end? Conventionally you would probably use an Array in the form of a stack - the "first on, first off" analogy. In this Array/Database there would be 3 columns - Employee name, Employee no. and ID. This is the same format as an SQL database. The ID is literally just a code assigned to every entry in the database and is purely for the purpose of referencing. Using SQL you can search the database by name, number and get data discretely by ID. I would say that, especially for a large solution, SQL would be your best option. SQL has all of your above features and with a little bit of coding you can fairly easily create a full program using them.
?
2016-08-09 08:47:18 UTC
Excuse, but a LinkList is an abstract knowledge kind, that is: one variable for the datastore and an itenerator managing the pointers. The itenerator has all the ways(), retaining the datastore sorted and together with a convenience system() for creating a new array to print or fetch the factors out from the datastore. I've by no means noticeable LinkedList outlined as an array.
anonymous
2013-03-31 03:00:44 UTC
Now and onwards you need to specify which programming language you need. The pseudo approach can vary highly depending on whether you write for a console in programming language like C++ or for object oriented Java environment or for components that are linked together, like web programming with separate database.



I could give you code for this in JavaScript but would that help?



Basically in your programming language find controls for inputting and outputting, then use objects of a class that holds three variables, the third being a pointer to next object in your linked list. Then finally define functions that would find, add or delete employee data. Of course not all programming languages have pointers, so you would still need to consider arrays.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...