Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to find duplicates in an array and remove them
efficiently?

Answers were Sorted based on User's Feedback



How to find duplicates in an array and remove them efficiently?..

Answer / vishnu


Dim a(4)

a(0) = 1
a(1) = 4
a(2) = 5
a(3) = 4
a(4) = 5

For i = ubound(a)-1 to 0 step - 1
For j=0 to i
If a(j) = a(j+1) Then
a(j) = empty
ElseIf a(j)>a(j+1) Then
temp = a(j+1)
a(j+1) = a(j)
a(j) = temp
End If
Next
Next

For i=0 to ubound(a)
print a(i)
Next

Is This Answer Correct ?    1 Yes 0 No

How to find duplicates in an array and remove them efficiently?..

Answer / crazy boy

**How to find duplicates in an array and remove them efficiently?
=================================================
dim a(4)
a(0)=10
a(1)=20
a(2)=10
a(3)=20
a(4)=50

for i=0 to ubound(a)
for j=i+1 to ubound(a)
if a(i)=a(j) then
a(i) =empty
end if
next
next

for i=0 to ubound(a)
if a(i)<>"" then
msgbox a(i)
end if
next

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

How to connect the real time application application with the QTP?

2 Answers  


How to use reporter.report event in qtp ?

0 Answers  


what is the syntax or command in vbscript to display user message example i want to display "welcome to QTP".

3 Answers  


Can i run the qtp, without OBJECT REPOSTIRY...

8 Answers  


.qfl extension for which file? where vl use it

1 Answers   iFlex,


Use of environment variables?

4 Answers  


Please explain how to open with notepad of saved html file by right click option using QTP

1 Answers  


How QTP recognizes Objects in AUT?

8 Answers   Blue Star,


Anybody explain me, the concept of checkpoint declaration in the QTP mainly for the Objects, Pages, Text and Tables ?

1 Answers  


how to create flat file datasubmission in qtp

0 Answers  


Which company is better amdocs or techm ???

2 Answers  


How we can add actions in the test using QTP?

2 Answers  


Categories