Hi guys i need help in algarithm code.
Remove All Occurrences
For this problem please start with the code provided in file list_reversal.cpp.
Add a new function to this code. The function should take two parameters: a list head and
an integer. The function should remove all elements of the list that contain that integer in
the “item” field.
Make sure that your function works correctly for all possible lists:
o empty list,
o list consisting of 1 element that needs to be removed
o this sample test data:
o list: 1 2 3 1 4 5 1. Elements holding 1 are being removed.
Note: Do not use IntList.cpp code for your solution. Specifically, don’t use deleteNode()
function multiple times, this approach is extremely inefficient. Your solution should
traverse the list only once.
i am tring to follow rhis step but kindda staring is hard
node * remove_all_occurrence (node * , int ); (1)
Characters of a String
Write a program that takes a string as argument, then prints out a table: for each character
that occurs in the string, the table contains the character and its frequency of occurrence.
Sample string: Alex A.
First, make an array of integer (1) initialized to 0 , which can hold 256 integers, and scanning a string, increase the value of index - the character code - the (1) array by 1.
Second, print each value and character if the value is not equal to 0 in traversing the (1) array.
Longest Sequence of Blanks
Write an efficient program that finds the length of the longest sequence of blanks in a
given string, examining as few characters in the string as possible.
Hint: Your program should become faster as the length of the sequence of blanks
Scan a string and find an occurrence of the head position and the last position of a sequence of blanks. Store the length and compare the largest length that may be store until now; if the length is bigger than the largest, update the largest with it.
Repeat the same procedure until you scan the last character in the string.