輸入字串陣列a[0],a[1],...a[4]
利用Java Class LinkedList 作初一鏈結串列:
[ a[0], a[1], a[2], a[4], a[4],a[3],a[2],a[0] ]
Hint:可利用方法addFirst, add, remove.....
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
11!=?
-
計算你上學期加權平均
-
計算你的BMI
-
輸出字串20次
-
int a[]={21, 23, 57, 13 ,17, 6}; float average; average=?
-
猜數字
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
C字串練習 字串 char word[]="You win!"; 輸出為: You win! You win You wi You w You You Yo Y 給進階使用者: gets () 是個危險的函式!
-
解釋memset, memcpy
48 則留言:
import java.util.*;
public class B1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package V1;
import java.util.*;
public class B9933052A {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
import java.util.*;
public class a1 {
public static void main(String[] args) {
String arr[]={"你", "我", "他","YA","HI"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.addFirst(x);
list.remove(3);
int x=list.indexOf("HI");
if (x!=-1)
list.add(x,"你,他,YA,HI");
System.out.println(list);
}
}
package pack1;
import java.util.*;
public class a1{
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package P1;
import java.util.*;
public class B1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list= new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
import java.util.*;
public class b1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package pack;
import java.util.*;
public class pack {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package p1;
import java.util.*;
public class b1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4],a[3], a[2],a[0]");
System.out.println(list);
}
}
package pack1;
import java.util.*;
public class A1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class ex1
{
public static void main(String[] args)
{
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class ex1
{
public static void main(String[] args)
{
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class b1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[0],a[1],a[2],a[3],a[4]");
System.out.println(list);
}
}
package pack1;
import java.util.*;
public class t1 {
public static void main(String[] args) {
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[0], a[1], a[2],a[3],a[4]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
package A11;
import java.util.*;
public class A11 {
public static void main(String[] args) {
String arr[]={"YA", "拉", "嘻","u","dk" };
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.addFirst(x);
list.remove(3);
int x=list.indexOf("dk");
if (x!=-1)
list.add(x,"YA,嘻,u,dk" );
System.out.println(list);
}
}
package a1;
import java.util.*;
public class p1 {
public static void main(String[] args) {
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove("a[3]");
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.println(list);
}
}
package a1;
import java.util.*;
public class p1 {
public static void main(String[] args) {
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove("a[3]");
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.println(list);
}
}
package V1;
import java.util.*;
public class 12A {
public static void main(String[] args) {
Stringarr[]={“a[0]”, “a[1]”, “a[2]”, “a[3]”, “a[4]”};
LinkedList<<String> list=new LinkedList<<String>();
for(String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]);
System.out.println(list);
}
}
import java.util.*;
class test1114
{
public static void main(String[] args)
{
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.print(list);
}
}
package P1 ;
import java.util.*;
class A{
public static void main(String[] args)
{
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.print(list);
}
}
import java.util.*;
public class B9933024 {
[public static void main(String[] args)
[{
[[String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
[[list.add(x);
list.remove(3);
list.add("a[4]");
[[list.add("a[3]");
[[list.add("a[2]");
[[list.add("a[0]");
[System.out.print(list);
}
}
import java.util.*;
public class A2
{
public static void main(String[] args)
{
String arr[]={ "喜", "怒", "哀", "樂", "嘆" };
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.addFirst(x);
list.remove(3);
int x=list.indexOf("嘆");
if (x!=-1)
list.add(x,"喜, 怒, 哀, 嘆" );
System.out.println(list);
}
}
import java.util.*;
public class B9933051
{
public static void main(String[] args)
{
String arr[]={"I","YOU","SHE","HE","IT"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
list.add("IT");
list.add("HE");
list.add("SHE");
list.add("I");
System.out.print(list);
}
}
package pack1;
import java.util.*;
public class A1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
import java.util.*;
class b9733054
{
public static void main(String[] args)
{
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.print(list);
}
}
package B1; import java.util.*; public class D { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package B1; import java.util.*; public class D { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package B1; import java.util.*; public class D { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package A3;
import java.util.*;
public class A5 {
public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package A3;
import java.util.*;
public class A5 {
public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }.
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList list=new LinkedList(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
張貼留言