Skip to content

Commit

Permalink
deque definition
Browse files Browse the repository at this point in the history
  • Loading branch information
flyhigher139 committed Aug 15, 2023
1 parent f9b5d4c commit 1a1cd62
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
15 changes: 15 additions & 0 deletions collection/deque/array_deque.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2023 igevin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package deque
15 changes: 15 additions & 0 deletions collection/deque/linked_deque.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2023 igevin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package deque
24 changes: 24 additions & 0 deletions collection/deque/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 igevin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package deque

type Deque[T any] interface {
AddFirst(t T) error
AddLast(t T) error
RemoveFirst() (T, error)
RemoveLast() (T, error)
PeekFirst() (T, error)
PeekLast() (T, error)
}

0 comments on commit 1a1cd62

Please sign in to comment.