Which is usedbto create quick and simple list
Answers
Answer:
In HTML
<html>
<head>
<title>List</title>
</head>
<body>
<ol>
<li>Bag</li>
<li>Bottle</li>
<li>pencil box</li>
</ol>
</body>
</html>
In c++
#include <iostream>
#include <list>
using namespace std;
// Function to print the list
void printList(list<int> mylist)
{
// Get the iterator
list<int>::iterator it;
// printing all the elements of the list
for (it = mylist.begin(); it != mylist.end(); ++it)
cout << ' ' << *it;
cout << '\n';
}
int main()
{
// Create a list with the help of constructor
// This will insert 100 10 times in the list
list<int> myList(10, 100);
printList(myList);
return 0;
}
OUTPUT
100 100 100 100 100 100 100 100 100 100
In Java
import java.util.*;
public class GFG {
public static void main(String args[])
{
// For ArrayList
List<Integer> list = new ArrayList<Integer>() {{
add(1);
add(3);
} };
System.out.println("ArrayList : " + list.toString());
// For LinkedList
List<Integer> llist = new LinkedList<Integer>() {{
add(2);
add(4);
} };
System.out.println("LinkedList : " + llist.toString());
// For Stack
List<Integer> stack = new Stack<Integer>() {{
add(3);
add(1);
} };
System.out.println("Stack : " + stack.toString());
}
}
OUTPUT
ArrayList : [1, 3]
LinkedList : [2, 4]
Stack : [3, 1]