answersLogoWhite

0

//Algorithm to perform the insertion and deletion operation of a linear arrayINSERT (ArrA, n, i, item) where ArrA is a linear array with n elements and i is a positive integer where i <=n. The element 'item' will be inserted into the ith position in ArrA.1. j = n2. repeat steps 3 and 4 while j >= i3. ArrA[j+1] = ArrA[j]4. j = j - 15. ArrA[i] = item6. n = n+1DELETE (ArrA, n, i, item) where ArrA is a linear array with n elements and i is a positive integer where i <=n. The element 'item' will be deleted from the ith position in ArrA.1. item = ArrA[i]2. repeat for j = i to n -1 ArrA[j] = ArrA[j+1]4. n = n - 1NO HARD RETURNS ALLOWED

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

What are the various operations that can be performed on a queue?

In queue insertion takes place on rear end and deletion takes place on front end. INSERTION(QUEUE,N,FRONT,REAR,ITEM) :QUEUE is the name of a array on which we are implementing the queue having size N. view comlete ans at http://mcabcanotes.in/algorithm-to-perform-insertion-and-deletion-in-a-queue/


WHAT IS THE DIFFERENT algorithm of advantage and amp disadvantage?

Different algorithms do different things, so it makes no sense to compare them. For example, the accumulate algorithm is an algorithm which performs the same operation upon every element of a container, whereas a sorting algorithm sorts the elements of a container. Each specific algorithm requires a different set of concepts. An accumulate algorithm requires a data sequence with at least forward iteration and elements which support the operation to be performed, whereas a sorting algorithm generally requires random access iterators and elements that support a given comparison operation (such as the less-than operator).Even if two algorithms have the exact same time and space complexities, it does not follow that both will complete the task in the same time. For instance, the accumulate algorithm is a linear algorithm with a time-complexity of O(n) regardless of which operation is being performed. However, the complexity of the operation itself can greatly affect the actual time taken, even when the operations have exactly the same time-complexity. For instance, if we use the accumulate algorithm in its default form (to sum all the elements in a data sequence), the operation itself has a constant-time complexity of O(1). If we choose another operation, such as scaling each element and summing their products, it will take much longer to complete the algorithm (possibly twice as long) even though the operation itself has the exact same time-complexity, O(1).Consider the time-complexity of adding one value to another:a += bThis has to be a constant-time operation because the actual values of a and b have no effect upon the time taken to produce a result in a. 0 += 0 takes exactly the same number of CPU cycles as 42 += 1000000.Now consider the operation to scale and sum:a += b * 42Here, 42 is the scalar. This also has to be a constant-time operation, but it will take longer to physically perform this operation compared to the previous one because there are more individual operations being performed (roughly twice as many).The only way to compare algorithms is to compare those that achieve exactly the same goal but do so in different ways. Only then does comparing their respective time-complexity make any sense. Even so, time-complexity is merely an indication of performance so two sorting algorithms with the exact same time-complexity could have very different runtime performance (it depends on the number and type of operations being performed upon each iteration of the algorithm). Only real-world performance testing can actually determine which algorithm gives the best performance on average.With sorting algorithms, we often find one algorithm ideally suited to sorting small sequences (such as heap sort) and others ideally suited to larger sets (such as merge sort). Combining the two to create a hybrid algorithm would give us the best of both worlds.


How do you RSA algorithm c?

Perform encryption on the following PT using RSA and find the CT p = 3; q = 11; M = 5


What is algorithm and what is the difference between logarithm and algorithm?

Algorithms are basically sequences of instructions to solve a problem or to perform a calculation. A logarithm is a specific mathematical concept. For more information on each, look at the sites listed below: Algorithms: http://en.wikipedia.org/wiki/Algorithm Logarithms: http://en.wikipedia.org/wiki/Logarithm


Which part of a machine language instruction specifies data on which an operation acts?

False, Op code specifies the operation to perform, the operand specifies the data.

Related Questions

Program for insertion and deletion operations in AVL tree?

Here is a high-level overview of insertion and deletion operations in an AVL tree: Insertion: Perform a standard BST insertion. Update the height of each node as the new node is inserted. Perform rotations if the balance factor of any node becomes greater than 1 or less than -1. Deletion: Perform a standard BST deletion. Update the height of each node as the node is deleted. Perform rotations if the balance factor of any node becomes greater than 1 or less than -1 to rebalance the tree.


What are the various operations that can be performed on a queue?

In queue insertion takes place on rear end and deletion takes place on front end. INSERTION(QUEUE,N,FRONT,REAR,ITEM) :QUEUE is the name of a array on which we are implementing the queue having size N. view comlete ans at http://mcabcanotes.in/algorithm-to-perform-insertion-and-deletion-in-a-queue/


Why comparisons are less in merge sort than insertion sort?

the main reason is: Merge sort is non-adoptive while insertion sort is adoptive the main reason is: Merge sort is non-adoptive while insertion sort is adoptive


What is the first language definition of the term "algorithm"?

An algorithm is a set of step-by-step instructions used to solve a problem or perform a task.


How do you perform operation in scientific notation?

The answer will depend on what operation you have in mind.


Why need algorithm?

if u want to work any program then the first step is perform step by step analysis so that algorithm is needed


What is the sequential step by step process which a computer uses to perform computations?

Algorithm


What is the meaning of the term "algorithm"?

An algorithm is a set of step-by-step instructions or rules used to solve a problem or perform a task in a computer program or in mathematics.


What does the term "algorithm" mean and how is it used in computer science?

An algorithm is a set of step-by-step instructions used to solve a problem or perform a task. In computer science, algorithms are used to process data, make decisions, and perform calculations in software programs. They are essential for computers to perform tasks efficiently and accurately.


What is a doctor that perform operation is called?

A surgeon.


WHY DO WE MULTIPLY DECIMALS?

If an operation calls for multiplication we multiply; if it calls for any other operation, we perform the other operation!


WHAT IS THE DIFFERENT algorithm of advantage and amp disadvantage?

Different algorithms do different things, so it makes no sense to compare them. For example, the accumulate algorithm is an algorithm which performs the same operation upon every element of a container, whereas a sorting algorithm sorts the elements of a container. Each specific algorithm requires a different set of concepts. An accumulate algorithm requires a data sequence with at least forward iteration and elements which support the operation to be performed, whereas a sorting algorithm generally requires random access iterators and elements that support a given comparison operation (such as the less-than operator).Even if two algorithms have the exact same time and space complexities, it does not follow that both will complete the task in the same time. For instance, the accumulate algorithm is a linear algorithm with a time-complexity of O(n) regardless of which operation is being performed. However, the complexity of the operation itself can greatly affect the actual time taken, even when the operations have exactly the same time-complexity. For instance, if we use the accumulate algorithm in its default form (to sum all the elements in a data sequence), the operation itself has a constant-time complexity of O(1). If we choose another operation, such as scaling each element and summing their products, it will take much longer to complete the algorithm (possibly twice as long) even though the operation itself has the exact same time-complexity, O(1).Consider the time-complexity of adding one value to another:a += bThis has to be a constant-time operation because the actual values of a and b have no effect upon the time taken to produce a result in a. 0 += 0 takes exactly the same number of CPU cycles as 42 += 1000000.Now consider the operation to scale and sum:a += b * 42Here, 42 is the scalar. This also has to be a constant-time operation, but it will take longer to physically perform this operation compared to the previous one because there are more individual operations being performed (roughly twice as many).The only way to compare algorithms is to compare those that achieve exactly the same goal but do so in different ways. Only then does comparing their respective time-complexity make any sense. Even so, time-complexity is merely an indication of performance so two sorting algorithms with the exact same time-complexity could have very different runtime performance (it depends on the number and type of operations being performed upon each iteration of the algorithm). Only real-world performance testing can actually determine which algorithm gives the best performance on average.With sorting algorithms, we often find one algorithm ideally suited to sorting small sequences (such as heap sort) and others ideally suited to larger sets (such as merge sort). Combining the two to create a hybrid algorithm would give us the best of both worlds.