본문 바로가기

Programming/Java

Dynamic Arrays in Java

반응형

Problems with Arrays

  • Fixed size
  • Can pick size at runtime
  • But size can't just be changed
  • So we run out of room

 

We want an Array That can grow

 

Elements of Dynamic Arrays

  • A list of items
  • Accessible by index efficiently - constant time
  • can grow arbitrarily long

 

We need

  1. The arrya to store the data in
  2. The capacity of the arrya (already available in Java)
  3. The number of items currently stored in the array

 

 

 

Dynamic array is ArrayList in java

 

 

반응형

'Programming > Java' 카테고리의 다른 글

퀵 정렬 자바  (0) 2022.02.10
HashTable in java  (0) 2022.02.10
BufferedReader와 BufferedWriter 사용법  (0) 2022.01.31
ArrayList functions  (0) 2022.01.30
생성자와 Getter Setter  (0) 2022.01.30