answersLogoWhite

0


Best Answer

//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

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write Algorithm to perform the insertion and deletion operation of a linear array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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

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


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 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.


Ability to perform certain logic operation?

The Logical operator has the ability to perform certain logic operations on its input. This is used in Boolean algebra.


What four general operation can a computer perform?

computer can perform input, process, output, and storage


Perform the indicated operation and leave answer in simplest form?

-- Since there is no operation indicated, you may assume that I have already performed it. -- In the space just below this text, you'll see the result presented in its simplest form:


How do you perform any operation by giving any operator?

You cannot perform any operation by giving any operator. The operation must be valid in the domain and range.For example, you often cannot perform the square rootoperation using the square root operator if your domain and range are integers. At the level of maths that I guess you are at (from this question), the square root of a negative number is not a operation that is defined.