Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Task 1:

Complete the body of this function. You do not need to check the precondition. You
may use the stack template class
bool balanced(const char p[ ], size_t n)
// Precondition: p[0]...p[n-1] contains n characters, each of which
// is '(', ')', '{' or '}'.
// Postcondition: The function returns true if the characters form a
// sequence of correctly balanced parentheses with each '(' matching
// a ')' and each '{' matching a '}'. Note that a sequence such as
// ( { ) } is NOT balanced because when we draw lines to match the
// parentheses to their partners, the lines cross each other. On the
// other hand, ( { } ) and { ( ) } are both balanced.
Task2:
Add the function to Task 1,Write a function that will swap pairs of elements in a given singlylinked list. Note that you have to actually swap the elements, not just the values, and that you
should modify the list in place (i.e. you should not create a copy of the list). For instance, the list
1->2->3->4->5->6->… becomes 2->1->4->3->6->5->…
Write a SortedInsert() function which given a list that is sorted in increasing order, and a single
node, inserts the node into the correct sorted position in the list. Use Insert() function of task 1
allocates a new node to add to the list, SortedInsert() takes an existing node, and just rearranges
pointers to insert it into the list.
Add a function to task 1 which accepts a linear linked list List and converts it to a circular linked
list.
Where List is a pointer to the front of the list.
Prototype of the function is as following
Node *Convert( Node *List)
The function below should insert a value as the head of a given UNORDERED linked list. Be
careful to first search for the given value. The value is inserted only if it does not exist in the
list. If the value exists, the function does nothing. Use Linked list implementation of Task 1 to
make this function run. Write down the code of insert function run the code, take snap shot
and paste it in your document.
struct Node{
int data;
Node* next;
};
The function prototype is given. Implement the function.
void insert(Node* &head, int value);
Your task is to design Dynamic Array (Class).
What is Dynamic Array?
Which can grow and shrink at run time.
Your class should work for one and two dimensional Arrays
The class should enable the user to perform the following tasks:
1) Create a dynamic array of size specified by the user. Use an integer to keep track of the
size
2) Ask the user for numbers to insert until the user presses -1. Insert each value in the array.
Create a new larger array when the array is full, copy all data to the new array, and release
the memory for the old array. Print the array after each insert.
3) Ask the user for any numbers to delete until the user presses -1. Find the index of the
entered value in the original array and then remove that index from the original array.
Stop when the array is empty or when the user presses -1. Keep on reducing the array size
and print the array after each removal.
4) Make sure to release any allocated memory not yet released.

Write an algorithm for a program that prompts the user to enter the radius of a circle, and then calculate its area


Write an algorithm for a program that prompts the user to enter the radius of a circle, and then calculate its perimeter


Write a program to find out the greatest between two numbers defined in two different classes by using friend function.


Write a menu driven program to perform the following operations in a header linked

list by using suitable user defined functions for each case. The head node keeps the

count of the total number of nodes in the list. The data node keeps the student

information: Name, Roll No, CGPA, Address_City, Branch.

1. Create

2. Display student information

3. Display the total number of nodes (in O(1) time)

4. Display the students’ details belonging to a particular branch

5. Display the students’ details securing > 7.5 CGPA and belonging to a given

branch.



 Explanation of the program

[Explain (where applicable)

l  how the loop executes

 

l · how the written function works

 

l · and anything that you think is necessary

LATEST TUTORIALS
APPROVED BY CLIENTS