Answered step by step
Verified Expert Solution
Question
1 Approved Answer
with the pics below, how can I solve this question? and do I need to add something? protected final int DEFCAP =100;// default capacity protected
with the pics below,
how can I solve this question? and do I need to add something?
protected final int DEFCAP =100;// default capacity protected int origcap; // original capacity protected T[] list; // array to hold this listas elements protected int numElements =0;// number of elements in this list protected int currentpos; // current position for iteration // set by find method protected boolean found; // true if element found, otherwise false protected int location; // indicates location of element if found I public ArrayUnsortedList () \{ list =(T[]) new Object [DEFCAP]; origCap = DEFCAP; public ArrayUnsortedList(int origCap) \{ list =(T[]) new object[origCap]; this.origcap = origCap; \} protected void enlarge() // Increments the capacity of the list by an amoun // equal to the original capacity. 1 // Create the larger array. T[] larger =(T[]) new object[list.length + origCap]; // Copy the contents from the smaller array into the larger array. for (int i=0; i= add element \} \} for (int index = numblements; index > location; index--) 1 protected final int DEFCAP =100;// default capacity protected int origcap; // original capacity protected T[] list; // array to hold this listas elements protected int numElements =0;// number of elements in this list protected int currentpos; // current position for iteration // set by find method protected boolean found; // true if element found, otherwise false protected int location; // indicates location of element if found I public ArrayUnsortedList () \{ list =(T[]) new object [DEFCAP]; origCap = DEFCAP; \} public ArrayUnsortedList(int origCap) 1 list =(T[]) new Object[origCap]; this.origcap = origcap; protected void enlarge() // Increments the capacity of the list by an amoun // equal to the original capacity. 1 // Create the larger array. T[] larger =(T[]) new object[list.length + origCap]; I/ Copy the contents from the smaller array into the larger array. for (int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started