How to find duplicates in an array and remove them
efficiently?
Answers were Sorted based on User's Feedback
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 |
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 |
How to connect the real time application application with the QTP?
How to use reporter.report event in qtp ?
what is the syntax or command in vbscript to display user message example i want to display "welcome to QTP".
Can i run the qtp, without OBJECT REPOSTIRY...
.qfl extension for which file? where vl use it
Use of environment variables?
Please explain how to open with notepad of saved html file by right click option using QTP
How QTP recognizes Objects in AUT?
Anybody explain me, the concept of checkpoint declaration in the QTP mainly for the Objects, Pages, Text and Tables ?
how to create flat file datasubmission in qtp
Which company is better amdocs or techm ???
How we can add actions in the test using QTP?