Skip to content

Commit 8c4089d

Browse files
committed
Add Grover's search algorithm implementation
1 parent 035a5be commit 8c4089d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

quantum/grover_search_algorithm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
https://en.wikipedia.org/wiki/Grover%27s_algorithm
99
"""
1010

11-
from typing import Dict
1211
from qiskit import QuantumCircuit, transpile
1312
from qiskit_aer import AerSimulator
1413

1514

16-
def grover_search(shots: int = 1024) -> Dict[str, int]:
15+
def grover_search(shots: int = 1024) -> dict[str, int]:
1716
"""
1817
Runs Grover's search algorithm for 2 qubits and returns measurement results.
1918
@@ -23,7 +22,7 @@ def grover_search(shots: int = 1024) -> Dict[str, int]:
2322
shots (int): Number of simulation shots.
2423
2524
Returns:
26-
Dict[str, int]: Measurement counts.
25+
dict[str, int]: Measurement counts.
2726
2827
Example:
2928
>>> result = grover_search(100)

quantum/q_fourier_transform.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"""
1414

1515
import math
16+
1617
import qiskit
1718
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute
1819

0 commit comments

Comments
 (0)