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 |
During test run,How will you copy/paste from/to clipboard?
i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that and friends i have one big doubt that is whether it is array or string ,how we come to know that and where we consider that it's array ,where we consider that it's an string because when i want to find the length i have big doubt whether we need to use len function or ubound ... ans me for this TWO Questions any one please
plz tel me what is the differnce between QC & QTP?
what is framework and types of framework? Need of framework in automation? write folder strucuture of framework.
What is checkpoints for quicktest professional (qtp)?
How to insert screenshot on to the body of outlook? -1 how to use insert-picture tab in new email outlook to insert image in the body. Suggest something.......
in Qtp,how to display user name and pwd (script)in data table(global sheet).
what is the framework followed by ur company in qtp
what are the different Frame Works in Quick Test Proffessional testing
What is the need and applications of learning VB script for a automation(QTP) engineer ain Realtime ?
Can we use smart identification in Keyword Driven approach? If yes , How we can use. Please Explain?
what is the purpose of .vbs file?