AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Algorithmen, Datenstrukturen und Klassendesign FInd duplicate array and a quick way to search item per line on file??
Thema durchsuchen
Ansicht
Themen-Optionen

FInd duplicate array and a quick way to search item per line on file??

Ein Thema von user · begonnen am 19. Nov 2010 · letzter Beitrag vom 19. Nov 2010
 
user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#1

FInd duplicate array and a quick way to search item per line on file??

  Alt 19. Nov 2010, 10:20
For example I have an sorted array.
array[0]=1
array[1]=3
array[2]=2
array[3]=2
array[4]=4

First,
I use binary search to find an item. I found array[2]. I want to find duplicate item from the array, so I check the next index, if the value of next index doesn't match with array[2], it mean no duplicate item found. Am in right way to find duplicate item?

Second,
I got the duplicate items : array[2] and array[3]. I store them in new array or maybe in stringlist.
I have file contain :
aa
bb
cc
dd
ee

Now, I want to get the value of third line from the file (third line = array[2]). I want to get the value of forth line from the file (forth line = array[3]). The point is I want to retrieve the value from line based on index of duplicate array.

How to do this properly? I don't want to load all lines to stringlist to get the index, because if I have >5000 lines, the memory consumption will large.

Thanks.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz