What are the steps involved in setting an array element with a sequence?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Think of a sequence as a line of people waiting in a queue. Each person is like an element that contains information (value). Now, to organize this line (array), you will have to perform a few actions.
Step 1: First, verify the array length – You need to know if there is enough room in the queue or not.
Step 2: Specify the location – Decide where a person stands (which index the new element goes to).
Step 3: Set the element – Assign a person to that place in line (store value in a specific index).
Remember, you cannot make a person appear twice in the same queue (assign same index again). If you try, the person will actually move from their old place in line (replace the old value).