Write a program that implements the linked list

Assignment Help Data Structure & Algorithms
Reference no: EM13161578

Write a program that implements the linked list Include the Node struct, the typedef NodePtr statement, and the head_insert() function Then write a main() that does these steps: creates a head for the list. add one item to the list. call head_insert() to add another 4 items to the list. Make sure each item has a different value for data. When you can do this without syntax errors, then your program might work. But it's hard to tell since you new the list items and they're not easy to see with breakpoints. So create a new function prototyped as int list_count( NodePtr ); // or int list_count( Node* ); This function takes as input the head of the linked list, and returns the number of items in the linked list. In this function, create a pointer like NodePtr current_item_in_list = NULL; Point current_item_in_list to the head of the list, and then loop it through the list until you find the NULL at the end of the list. Draw a picture of the list to keep track. Increment a counter to keep track of the items in the list. Get the function to work for a list that has 1 or more items in it. Then add code so that if there are NO items in the list (just the head pointing to NULL) that the function returns 0. Finally create a new function prototyped as void display_list( NodePtr ); This function takes as input the head of the linked list, and couts the data in each item of the list separated by a comma. So if the list contains 6 items, calling this function will result in a console display of something like The list contains 5, -1, 3, 6, 8, 7 Get this to work for lists that have one or more items in them (again, use something like current_item_in_list to loop through the list one item at a time, list_count() might also come in handy). Then add code so this function will work if all you have is a head pointing to NULL. In this special case display this: The list is empty After you get the two new functions to work correctly, modify main() to do this: create a zero-item list (just the head) call display_list() call list_count() and display result put one item in the list call display_list() call list_count() and display result put 4 or 5 more items in the list using head_insert() call display_list() call list_count() and display result The modified main(), head_insert(), display_list(), and list_count() functions are what will be in your final submission. 

Reference no: EM13161578

Questions Cloud

Find the vector clocks of all the events : Suppose Process P1 has events e11, e12, e13, e14, e15 e16 e17 P2 has events e21, e22, e23, e24, e25, e26, P3 has events e31, e32, e33, e34, e35 e36 There are message transits from e12 to e22, e24 to e15, e21 to e32, e35 to e25.
The drinking water for the people who live in south dakota : The Ogallala aquifer is the largest in the United States, covering 450,000 across eight states, from South Dakota to Texas. This aquifer provides 82% of the drinking water for the people who live in this region
Can be done with primary keys : Explain what can be done with primary keys to eliminate key ripple effects as a database evolves.
State unique functional groups and number of carbons atoms : Draw the structures of the compounds listed below in groups of isomers and classify them according to their unique functional groups and number of carbons atoms
Write a program that implements the linked list : Write a program that implements the linked list Include the Node struct, the typedef NodePtr statement, and the head_insert() function Then write a main() that does these steps: creates a head for the list.
Explain why limp celery becomes crisp : Explain why limp celery becomes crisp and the skin of your fingertips wrinkles when placed in tap water. (The principle is exactly the same.)
Keyboard combinations that can increase : Microsoft® Word provides keyboard combinations that can increase a user's efficiency. How can these shortcuts simplify the support process for Microsoft® Word
State what is the entropy change if two mole of liquid water : What is the entropy change if two mole of liquid water is heated from 20 C to 100 C under constant pressure? Cp=75.5 J/mol*K over this temperature interval
What is the most likely diagnosis : John is a 26 year old man who begins to notice a progressive enlargement of feet, hands, cranium, nose, and lower jawbone. His doctor recommends irradiation of the pituiatary gland. What is the most likely diagnosis? Why?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Dbms and data mining to imporve customer service

Discuss how a database management system and data mining can help motor vehicle maintenance center improve its services, and what tables would be required in such a database.

  Show result of inserting keys using linear probing

Show the result of inserting these keys using linear probing, using quadratic probing with c1 = 1 and c2 = 3, and using double hashing with h2(k) = 1 + (k mod (m ¡ 1)).

  Hardware platform of the target embedded systems

An embedded system is a computer system performing dedicated functions within a larger mechanical or electrical system. Embedded systems range from portable devices such as Google Glasses, to large stationary installations like traffic lights, fa..

  Algorithms to insert entry into list and find entry in list

In array is pointer to linked list of nodes each of which starts with corresponding letter. Write algorithms to insert the entry into list and to find entry in the list.

  Build a binary search tree

Build a binary search tree using the following set of numbers, preserving the orderin which they are given: 34,26,47,22,28,10,24,38,51,49,37,4,45,60,57,14.

  Conceptual model entity relationship diagram

Assume you are asked you to create a new entity-relationship diagram for a corporation for a customized shipment tracking system.

  Preparing a java program

Prepare a program that asks the user how many automobiles are to be explained, and for each automobile it inputs the user's selection of make and color.

  Algorithm for finding smallest element in unsorted array

Consider the following algorithm for finding the smallest element in an unsorted array: RANDOMMIN(A[1 .. n]). What is the exact expected number of executions of line ( )?

  Algorithm to find maximum sum of contiguous sublist

Using dynamic programming, write an algorithm to find the maximum sum of contiguous sublist of a given list of n real values.

  Question about unix commands

Assume you have a document called records.txt having the list of employee id and workers names. Every line contains a single employee id immediately followed by the employee name in the format Last name, First name.

  Determining public keys for other party in sending message

Determine correct public keys for other party, and assuming that Eve can intercept any messages.

  Create a solution algorithm using pseudocode

Algorithm that will receive two integer items from a terminal operator, and display to the screen their sum, difference, product and quotient.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd