Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
College aantekeningen

Class notes DSA

Beoordeling
-
Verkocht
-
Pagina's
119
Geüpload op
11-03-2023
Geschreven in
2022/2023

1.3 Array Operations | Deletion from Array | Explanation with Code | Data Structure Jenny's Lectures CS IT I will discuss the deletion operation using the example I used in a previous video. Understanding how to delete data from a specific position will also make it easier to delete data from the beginning or end of the array. I declared an array of size 50 in the previous code, and the memory manager allocated 200 bytes of memory for this array. One variable, size, is used to determine the maximum size of the array. If the user wants to insert only 10 or 5 elements, for example, I will ask them how much size they want for the array, and this will allocate an additional 4 bytes of memory. The user will then enter the elements of the array, which will be initialized at runtime. To delete data from the array, I will ask the user from which position they want to delete the data. For example, if they want to delete data from position 2, I will shift the values from position 3 to 4 and reduce the size of the array by 1. I will start a loop from the position to be deleted to the end of the array and shift the values to the left. To print the updated array after deletion, I will use a for loop to print each element of the array. It's important to check the validity of the position entered by the user before deleting data from the array. If the position is invalid, such as -1 or greater than the size of the array, I will print "invalid position". If there is no data in the array, it's also an underflow condition and the data cannot be deleted. When deleting data from the end of the array, I will simply decrement the size of the array. When deleting data from the beginning of the array, I will shift all the elements to the left and decrement the size of the array. The time complexity of the deletion operation depends on the position from which the data is to be deleted. If the data is to be deleted from a specific position, all the elements to the right of that position must be shifted to the left, which takes O(n) time. However, if the array is unsorted, a quicker algorithm is to pick the last element of the array and put it in the position to be deleted. The best algorithm for this case takes constant time, which is O(1).

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

--------- beginning of main
04-29 15:41:12.030 24191 24191 I oplus.android.OplusFrameworkFactoryImpl:
getOplusRedPacketManager
04-29 15:41:12.035 24191 24191 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.036 24191 24228 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.050 24191 24227 W AudioCapabilities: Unsupported mime audio/ffmpeg
04-29 15:41:12.050 24191 24227 W AudioCapabilities: Unsupported mime audio/x-adpcm-
ms
04-29 15:41:12.050 24191 24227 W AudioCapabilities: Unsupported mime audio/x-adpcm-
dvi-ima
04-29 15:41:12.050 24191 24227 W AudioCapabilities: Unsupported mime audio/alac
04-29 15:41:12.050 24191 24227 W AudioCapabilities: Unsupported mime audio/ape
04-29 15:41:12.050 24191 24227 W AudioCapabilities: Unsupported mime audio/x-ms-wma
04-29 15:41:12.050 24191 24227 W VideoCapabilities: Unsupported mime
image/vnd.android.heic
04-29 15:41:12.051 24191 24227 W VideoCapabilities: Unsupported mime video/ffmpeg
04-29 15:41:12.052 24191 24227 W VideoCapabilities: Unrecognized profile/level 1/32
for video/mp4v-es
04-29 15:41:12.052 24191 24227 W VideoCapabilities: Unrecognized profile/level
32768/2 for video/mp4v-es
04-29 15:41:12.052 24191 24227 W VideoCapabilities: Unrecognized profile/level
32768/64 for video/mp4v-es
04-29 15:41:12.052 24191 24227 W VideoCapabilities: Unsupported mime video/x-ms-wmv
04-29 15:41:12.053 24191 24227 W VideoCapabilities: Unsupported mime video/xvid
04-29 15:41:12.053 24191 24227 W VideoCapabilities: Unrecognized profile/level 1/32
for video/mp4v-es
04-29 15:41:12.062 24191 24227 I OplusCameraManager: saveOpPackageName,
mOpPackageName: com.android.hasli.lmc82
04-29 15:41:12.063 24191 24227 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.063 24191 24227 I OplusCameraManagerGlobal: Connecting to camera
service
04-29 15:41:12.064 24191 24227 I CameraManagerGlobal: Connecting to camera service
04-29 15:41:12.068 24191 24231 W oid.hasli.lmc8: Accessing hidden field
Ljava/util/Collections$SynchronizedCollection;->mutex:Ljava/lang/Object; (greylist-
max-o, reflection, denied)
04-29 15:41:12.068 24191 24231 W oid.hasli.lmc8: Accessing hidden method
Ljava/util/Collections$SynchronizedSet;-><init>(Ljava/util/Set;Ljava/lang/Object;)V
(greylist-max-o, reflection, denied)
04-29 15:41:12.068 24191 24231 W oid.hasli.lmc8: Accessing hidden method
Ljava/util/Collections$SynchronizedCollection;-><init>(Ljava/util/
Collection;Ljava/lang/Object;)V (greylist-max-o, reflection, denied)
04-29 15:41:12.073 24191 24228 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.075 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.075 24191 24227 I chatty : uid=10265(com.android.hasli.lmc82)
GcaGeneric-1 identical 1 line
04-29 15:41:12.076 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.076 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.076 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.076 24191 24228 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.077 24191 24227 E Parcel : Reading a NULL string not supported

,here.
04-29 15:41:12.079 24191 24227 I chatty : uid=10265(com.android.hasli.lmc82)
GcaGeneric-1 identical 6 lines
04-29 15:41:12.079 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.079 24191 24233 D CameraManager2: GotArray:0
04-29 15:41:12.079 24191 24233 D CameraManager2: GotArray:1
04-29 15:41:12.079 24191 24233 D CameraManager2: GotArray:2
04-29 15:41:12.079 24191 24233 D CameraManager2: GotArray:3
04-29 15:41:12.079 24191 24233 D CameraManager2: GotArray:4
04-29 15:41:12.079 24191 24233 D CameraManager2: GotArray:6
04-29 15:41:12.080 24191 24227 E Parcel : Reading a NULL string not supported
here.
--------- beginning of system
04-29 15:41:12.090 24191 24191 E OplusCustomizeRestrictionManager: sInstance is
null, start a new sInstance
04-29 15:41:12.089 24191 24227 I chatty : uid=10265(com.android.hasli.lmc82)
GcaGeneric-1 identical 9 lines
04-29 15:41:12.089 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.093 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.094 24191 24227 I chatty : uid=10265(com.android.hasli.lmc82)
GcaGeneric-1 identical 5 lines
04-29 15:41:12.094 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.095 24191 24227 D CameraManager2: GotArray:0
04-29 15:41:12.095 24191 24227 D CameraManager2: GotArray:1
04-29 15:41:12.095 24191 24227 D CameraManager2: GotArray:2
04-29 15:41:12.095 24191 24227 D CameraManager2: GotArray:3
04-29 15:41:12.095 24191 24227 D CameraManager2: GotArray:4
04-29 15:41:12.095 24191 24227 D CameraManager2: GotArray:6
04-29 15:41:12.096 24191 24227 W CAM_A : Build number (1648667696271) is not a
number. Ignoring version check for b/149569689.
04-29 15:41:12.096 24191 24227 D CameraManager2: GotArray:0
04-29 15:41:12.096 24191 24227 D CameraManager2: GotArray:1
04-29 15:41:12.096 24191 24227 D CameraManager2: GotArray:2
04-29 15:41:12.096 24191 24227 D CameraManager2: GotArray:3
04-29 15:41:12.096 24191 24227 D CameraManager2: GotArray:4
04-29 15:41:12.096 24191 24227 D CameraManager2: GotArray:6
04-29 15:41:12.097 24191 24227 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.098 24191 24227 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.102 24191 24238 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.102 24191 24227 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.113 24191 24227 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.114 24191 24227 I chatty : uid=10265(com.android.hasli.lmc82)
GcaGeneric-1 identical 1 line
04-29 15:41:12.115 24191 24227 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.142 24191 24247 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.144 24191 24233 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.147 24191 24249 I OplusCameraManagerGlobal: setClientInfo,

,packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.148 24191 24249 I CameraManagerGlobal: postSingleUpdate
onCameraAvailable=0
04-29 15:41:12.148 24191 24249 I CameraManagerGlobal: postSingleUpdate
onCameraAvailable=1
04-29 15:41:12.148 24191 24249 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.149 24191 24249 I chatty : uid=10265(com.android.hasli.lmc82)
Camera-Ex identical 1 line
04-29 15:41:12.149 24191 24249 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.150 24191 24227 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.151 24191 24233 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.152 24191 24249 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.153 24191 24249 I OplusCameraManagerGlobal: setClientInfo,
packageName: com.android.hasli.lmc82, uid: 10265, pid: 24191
04-29 15:41:12.159 24191 24249 I OplusCameraUtils: current activityName:
com.google.android.apps.camera.legacy.app.activity.main.CameraActivity
04-29 15:41:12.159 24191 24249 I OplusCameraUtils: getComponentName, componentName:
com.android.hasli.lmc82/com.google.android.apps.camera.legacy.app.activity.main.Cam
eraActivity, packageName:com.android.hasli.lmc82,
activityName:com.google.android.apps.camera.legacy.app.activity.main.CameraActivity
04-29 15:41:12.165 24191 24237 W CAM_DeviceErrorBroadcas: Tag
DeviceErrorBroadcaster is 3 chars longer than limit.
04-29 15:41:12.167 24191 24218 I CameraManagerGlobal: postSingleUpdate
onCameraAvailable=1
04-29 15:41:12.175 24191 24237 I BufferQueueConsumer: [](id:5e7f00000000,api:0,p:-
1,c:24191) connect(): controlledByApp=true
04-29 15:41:12.176 24191 24237 I SurfaceFactory: [static] sSurfaceFactory =
com.mediatek.view.impl.SurfaceFactoryImpl@7e7cdbf
04-29 15:41:12.177 24191 24237 I BufferQueueConsumer: [](id:5e7f00000001,api:0,p:-
1,c:24191) connect(): controlledByApp=true
04-29 15:41:12.200 24191 24191 I DeezNuts: MSG: SLIDER 1 FOCUS: 1.0E-4
04-29 15:41:12.200 24191 24191 I ProReC : setprogres0
04-29 15:41:12.202 24191 24191 I DeezNuts: MSG: SLIDER 0 IDX: 0
04-29 15:41:12.202 24191 24191 I ProReC : setprogres_iso0
04-29 15:41:12.202 24191 24191 I za.defcomk.prorec.cust2.RotSeek: setprogres_iso0
04-29 15:41:12.204 24191 24191 D TestOverScroll: getScaledOverscrollDistance: b
04-29 15:41:12.237 24191 24249 I BufferQueueProducer: [ImageReader-2304x1728f20m30-
24191-0](id:5e7f00000000,api:4,p:1083,c:24191) connect(): api=4
producerControlledByApp=false
04-29 15:41:12.242 24191 24249 I BufferQueueProducer: [ImageReader-640x480f23m52-
24191-1](id:5e7f00000001,api:4,p:1083,c:24191) connect(): api=4
producerControlledByApp=false
04-29 15:41:12.256 24191 24227 E ion : ioctl c0044901 failed with code -1:
Invalid argument
04-29 15:41:12.256 24191 24191 D ColorViewRootUtil: initSwipState,
isDisplayCompatApp false
04-29 15:41:12.256 24191 24191 D ColorViewRootUtil: mScreenHeight 2400,
mScreenWidth 1080
04-29 15:41:12.257 24191 24227 D skia : SkJpegCodec::onGetPixels +
04-29 15:41:12.258 24191 24227 D skia : stream getLength() not supported, use
temp buffer for loading stream, buffer addr 0x78da02b000 length 197966
04-29 15:41:12.260 24191 24233 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.260 24191 24227 D skia : size 197966,phy_addr 0x43a00000

, 04-29 15:41:12.260 24191 24227 D skia : LoadInputStreamToIonMem va 0x78da02b000
pa 0x43a00000 size 200192
04-29 15:41:12.263 24191 24227 D libjpeg-alpha: Huffman Builder run in subthread
04-29 15:41:12.265 24191 24227 D libjpeg-alpha: Tile Decoder (#thread:4, size:512
512 512 384x272, alignment:256x16)
04-29 15:41:12.267 24191 24191 D ViewRootImpl[CameraActivity]: hardware
acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false,
forceHwAccelerated = false, sSystemRendererDisabled = false
04-29 15:41:12.275 24191 24191 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.276 24191 24191 I chatty : uid=10265(com.android.hasli.lmc82)
identical 4 lines
04-29 15:41:12.276 24191 24191 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.276 24191 24191 I InputTransport: Create ARC handle: 0x7864d28d00
04-29 15:41:12.277 24191 24191 V PhoneWindow: DecorView setVisiblity: visibility =
0, Parent = android.view.ViewRootImpl@874b645, this =
DecorView@798d19a[CameraActivity]
04-29 15:41:12.282 24191 24227 D skia : SkJpegCodec::onGetPixels -
04-29 15:41:12.289 24191 24231 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.290 24191 24231 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.317 24191 24191 V OplusZoomWindowDecorViewHelper:
setLastReportedMergedConfiguration mZoomDisplayHeight: 2400
getDecorView.DecorView@798d19a[CameraActivity]
04-29 15:41:12.318 24191 24214 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.323 24191 24214 E EGL-gift: Cannot load register apis
04-29 15:41:12.325 24191 24214 I GED : [GT]_get_procNameprocess pid(24191)
04-29 15:41:12.325 24191 24214 I GED : [GT]_getprocess
name(com.android.hasli.lmc82)
04-29 15:41:12.325 24191 24214 I oid.hasli.lmc8: [GT] ret(1) gt_status(00000000)
aniso_debug_level(0) gt_aniso_max_level(16) ani so mask(00000001) tri
mask(00000002)
04-29 15:41:12.325 24191 24214 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.328 24191 24214 I chatty : uid=10265(com.android.hasli.lmc82)
RenderThread identical 44 lines
04-29 15:41:12.328 24191 24214 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.328 24191 24214 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.328 24191 24214 I chatty : uid=10265(com.android.hasli.lmc82)
RenderThread identical 16 lines
04-29 15:41:12.328 24191 24214 E libEGL : Invalid file path for libcolorx-
loader.so
04-29 15:41:12.336 24191 24214 E ion : ioctl c0044901 failed with code -1:
Invalid argument
04-29 15:41:12.355 24191 24191 W CAM_A : Was already registered as
ThermalStatusListener on AppStart
04-29 15:41:12.355 24191 24230 V SensorManager: RegisterListener Rotation Vector
Sensor type:11 delay:200000us by gti
04-29 15:41:12.355 24191 24230 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.725 24191 24233 E Parcel : Reading a NULL string not supported
here.
04-29 15:41:12.725 24191 24237 W CAM_SimpleReqProcessor: Failed to add Stream-1 to
CaptureRequest for Request-0. The surface (null) was not valid.

Geschreven voor

Vak

Documentinformatie

Geüpload op
11 maart 2023
Aantal pagina's
119
Geschreven in
2022/2023
Type
College aantekeningen
Docent(en)
Dsa
Bevat
Alle colleges

Onderwerpen

$8.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
Âñßhűłpûřī1

Maak kennis met de verkoper

Seller avatar
Âñßhűłpûřī1
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
3 jaar
Aantal volgers
0
Documenten
1
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen