Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
Linear Data Structure 507
Insert an element at starting: 3
Linked list elements are: 3 9 5 1 2 3 4
Explanation The creation of a linked list is same as explained in the previous program. Here, an
element is inserted at the beginning. The function void atbeg () performs this task. In this function
two pointers *node (local to this function) and *t are declared. The m alloc () function allocates
memory to pointer node. The entered element is placed in the newly created node. Consider the
following statements.
t=first;
header=node;
header - >next=t;
first=header;
The above four statements adjust the pointer links.
t=first: This statemen
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343