Você está na página 1de 11

MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.

First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 1 Enter the element to be inserted : 3 MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 1 Enter the element to be inserted : 4 MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar)

(nthcdr)

(nthcdr)

(nthcdr)

9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 2 List : [1, 2, 3, 4] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 3 First element : [1] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 4 [2, 3, 4]

(nthcdr)

(nthcdr)

MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 5 Enter the element to be added as the first element : 6 [6, 1, 2, 3, 4] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 6 Size of the list : 5 MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list

(nthcdr)

(nthcdr)

7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 7 Enter the value of n : 2 [2, 3, 4] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 8

(nthcdr)

(nthcdr)

Enter the element you want to replace as the first element of the list : 5 [5, 1, 2, 3, 4] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit

(nthcdr)

Enter your choice : 9 Enter the number of elements you want to insert in the list : 2 Enter the element : 6 Enter the element : 7 List:[6, 7] [5, 6, 7] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 10 Enter the index : 2 Element : 7 MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 11

(nthcdr)

(nthcdr)

[5, 7] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice : 12 [6] MENU : 1.Create an ArrayList (insert a new element into the list) 2.Display the list 3.First element (car) 4.Remaining elements other than the first (cdr) 5.Add data as first element in the list (cons) 6.No. of elements in the list 7.Returns the remaining elements except the first 'n' elements 8.Replace the first element (setcar) 9.Add list (setcdr) 10.nth element of a list (nthlist) 11.First and last element of the list 12.cadr() 13.Exit Enter your choice :

(nthcdr)

(nthcdr)

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\sindhu>cd/ C:\>e: E:\>cd jav E:\jav>javac ex4a.java Note: ex4a.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: ex4a.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. E:\jav>java ex4a Creating the arraylist... Size of the arraylist : 6 Array list: [algorithms, pseudo-codes, flow-charts, programs, code, assembli ng]

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 1 Enter the string to be appended : data Array List: [algorithms, pseudo-codes, flow-charts, programs, code, assembli ng, data]

MENU : 1.Append 2.Insert at a particular index 3.Delete

4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 2 Enter the index and the string to be inserted at that position : 2 software Array List: [algorithms, pseudo-codes, software, flow-charts, programs, code , assembling, data]

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 3 Enter the string to be deleted : data Array List: [algorithms, pseudo-codes, software, flow-charts, programs, code , assembling]

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit

Enter your choice : 4 Enter the index and the new string that is to be placed in that position : 2 system Array List: [algorithms, pseudo-codes, system, flow-charts, programs, code, assembling]

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 5 Enter the element :programs Element found!!

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 6 Enter the element for which the index is to be found : system Index : 2 Array List: [algorithms, pseudo-codes, system, flow-charts, programs, code, assembling]

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 7 algorithms assembling

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit Enter your choice : 8 Array List: [algorithms, pseudo-codes, system, flow-charts, programs, code, assembling, C, C++, Java]

MENU : 1.Append 2.Insert at a particular index 3.Delete 4.Replace 5.Search 6.Index of 7.List of all strings starting with 'a' 8.Append the contents of another list at the end of the first 9.Exit

Enter your choice : 9 Program terminating!! E:\jav>

Você também pode gostar