Follow

Translate

Tuesday, March 22, 2016

Deletion Algorithms


Algorithms which delete nodes from linked lists come up in various situations. We discuss two of them here. The first one deletes the node following a given node, and the second one deletes the node with a given ITEM of information. All our algorithms assume that the linked list is in memory in the form LIST(INFO, LINK, START, AVAIL).

All of our deletion algorithms will return the memory space of the deleted node N to the beginning of the AVAIL list.  Accordingly,  all of our algorithms will include the following pair of assignments, where LOC is the location of the deleted node N:

LINK[LOC] : = AVAIL and then AVAIL : = LOC


Some of the algorithms may want to delete either the first node or the last node from the list. An algorithms that does so must check to see if there is a node in the list,  If not, i.e, If START = NULL, then the algorithms will print the message UNDERFLOW.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

Related Posts:

  • Number Sorted Of Bubble Sort Suppose the following numbers are stored in an array A:                             … Read More
  • Example Using the bubble sort algorithm Using the bubble sort algorithm, Algorithm 4.4, find the number C of comparisons and the number D of interchanges which alphabetize the n = 6 letters in PEOPLE. The sequence of pairs of letters which are compared in … Read More
  • Binary Search Algorithm 4.6:  (Binary Search)  BINARY(DATA, LB, UB, ITEM, LOC) Here DATA ia a sorted array with lower bound LB and upper bound UB, and ITEM is a given item of information. The variables BEG, END and MID denote,… Read More
  • Deleting From a Linear Array Algorithm:  (Deleting From a Linear Array)  DELETE (LA, N, K, ITEM) Here LA is a linear array with N elements and K is a positive integer such that K < N. This algorithms Deletes… Read More
  • Inserting Into a Linear Array Inserting Into a Linear Array Algorithm:  (Inserting into a Linear Array) INSERT (LA, N, K, ITEM) Here LA is a linear array with N elements and K is a positive integer such that K < N. This algorithms inserts an ele… Read More

0 comments:

Post a Comment