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

  Server of local hospital to support remote access

Explain the file system that will be installed in the server of your local hospital to support remote access of data through the hospital's doctors while they are using their mobile equipments such as cellular phones or PDAs.

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Algorithm to produce a list of customers

Draw an algorithm to produce a list of customers from the Glad Rags Clothing Company's customer master file.

  Process of insertion into a heap-implemented priority queue

Explain the process of insertion into a heap-implemented priority queue, and informally explain its complexity and the process of removal from a heap-implemented priority queue, and informally explain its complexity.

  Making visual studio.net web application

Make a Visual Studio.NET 2005 web application with 2-aspx forms. Add a Menu control and a Label control to form. Populate the Menu control with data stored in the "Font" column and show your name in the Label control.

  Write algorithm to calculate the median using queries

Calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.

  Determine the transmission rate

Assume two TCP connections are available over some bottleneck link of rate R bps. Both connections have a huge document to send in the similar direction over the bottleneck link

  Universalist rationality theory

Universalist rationality theory supposes that actors within an institution are rational. They function with their own material interests in mind, maximizing efficiency and resources.

  Give algorithm-correctness proof-time complexity for tree

Determine the minimum number of nodes in tree to remove so that the tree is separated into subtrees of sizes at most k. Give the algorithm, the correctness proof and the time complexity.

  Comparison of the applicability of array

Data structures include: 1. a linked list, 2. an ordered, one dimensional array, and three. a binary tree. Assume the list of letters R, A, N, B, C, F, X and G are stored in a list.

  Explain spacewise efficient implementation two-stack data

Structure of such two-stack data type would consist of two arrays and two top pointers. Describe why this may not be a spacewise efficient implementation.

  Relationships in a database model

Discuss different types of classifications and do they overlap, or do they each tell us something unique about the entity relationship?

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